namespace FineUtil.PaperGeo
{

    /// <summary>
    /// Size of figure.
    /// </summary>
    public struct GeoSize
    {
        
        /// <summary>
        /// Width.
        /// </summary>
        public readonly int W;


        /// <summary>
        /// Height.
        /// </summary>
        public readonly int H;
        
        
        
        /// <summary>
        /// Trivial constructor.
        /// </summary>
        /// <param name="w">width.</param>
        /// <param name="h">height.</param>
        public GeoSize(int w, int h)
        {
            this.W = w;
            this.H = h;
        }

        
        
        /// <summary>
        /// Determinses that both width and height are positive.
        /// </summary>
        public bool Positive
        {
            get { return W > 0 && H > 0; }
        }
        
        
        public override string ToString()
        {
            return "(_" + W + "," + H + "_)";
        }

        public bool Equals(GeoSize size2)
        {
            return this.W == size2.W
                && this.H == size2.H;
        }

        public override bool Equals(object obj)
        {
            return Equals((GeoSize)obj);
        }
        
        public static bool operator == (GeoSize s1, GeoSize s2)
        {
            return s1.W == s2.W && s1.H == s2.H;
        }
        
        public static bool operator != (GeoSize s1, GeoSize s2)
        {
            return s1.W != s2.W || s1.H != s2.H;
        }
        
        
        public override int GetHashCode()
        {
            return (W*29 + H*13 + (W ^ H)) & 0x7FFFFFFF;
        }
    }


}
